@sealcode/jdd 0.6.5 → 0.7.0

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 (79) hide show
  1. package/.nyc_output/5ddf9c01-2e58-48c7-b45f-0b14d93f5fc2.json +1 -0
  2. package/.nyc_output/processinfo/5ddf9c01-2e58-48c7-b45f-0b14d93f5fc2.json +1 -0
  3. package/.nyc_output/processinfo/index.json +1 -1
  4. package/.xunit +21 -7
  5. package/@types/clumps.d.ts +1 -0
  6. package/@types/component-arguments/component-argument.d.ts +3 -2
  7. package/@types/component-arguments/component-arguments.d.ts +1 -0
  8. package/@types/component-arguments/component.d.ts +15 -0
  9. package/@types/component-arguments/list.d.ts +2 -2
  10. package/@types/component-arguments/markdown.d.ts +1 -1
  11. package/@types/component-arguments/nested-component.d.ts +24 -0
  12. package/@types/component-arguments/number.d.ts +23 -0
  13. package/@types/component-arguments/short-text.d.ts +1 -1
  14. package/@types/component-arguments/structured.d.ts +5 -3
  15. package/@types/component-arguments/table.d.ts +3 -3
  16. package/@types/component.d.ts +4 -4
  17. package/@types/index.d.ts +0 -2
  18. package/@types/jdd-context.d.ts +7 -2
  19. package/@types/jdd.d.ts +2 -2
  20. package/coverage/clover.xml +513 -296
  21. package/lib/clumps.js +4 -0
  22. package/lib/clumps.js.map +1 -0
  23. package/lib/component-arguments/component-argument.js +3 -0
  24. package/lib/component-arguments/component-argument.js.map +1 -1
  25. package/lib/component-arguments/component-arguments.js +1 -0
  26. package/lib/component-arguments/component-arguments.js.map +1 -1
  27. package/lib/component-arguments/component-arguments.test.js +11 -12
  28. package/lib/component-arguments/component-arguments.test.js.map +1 -1
  29. package/lib/component-arguments/component.js +111 -0
  30. package/lib/component-arguments/component.js.map +1 -0
  31. package/lib/component-arguments/container-argument.js +3 -2
  32. package/lib/component-arguments/container-argument.js.map +1 -1
  33. package/lib/component-arguments/list.js +3 -3
  34. package/lib/component-arguments/list.js.map +1 -1
  35. package/lib/component-arguments/list.test.js +1 -2
  36. package/lib/component-arguments/list.test.js.map +1 -1
  37. package/lib/component-arguments/markdown.js +1 -1
  38. package/lib/component-arguments/markdown.js.map +1 -1
  39. package/lib/component-arguments/nested-component.js +188 -0
  40. package/lib/component-arguments/nested-component.js.map +1 -0
  41. package/lib/component-arguments/number.js +58 -0
  42. package/lib/component-arguments/number.js.map +1 -0
  43. package/lib/component-arguments/short-text.js +1 -1
  44. package/lib/component-arguments/short-text.js.map +1 -1
  45. package/lib/component-arguments/single-reference.js +2 -2
  46. package/lib/component-arguments/single-reference.js.map +1 -1
  47. package/lib/component-arguments/structured.js +3 -3
  48. package/lib/component-arguments/structured.js.map +1 -1
  49. package/lib/component-arguments/structured.test.js +1 -2
  50. package/lib/component-arguments/structured.test.js.map +1 -1
  51. package/lib/component-arguments/table.js +4 -4
  52. package/lib/component-arguments/table.js.map +1 -1
  53. package/lib/component.js +6 -6
  54. package/lib/component.js.map +1 -1
  55. package/lib/component.test.js +9 -3
  56. package/lib/component.test.js.map +1 -1
  57. package/lib/components/markdown.test.js +13 -2
  58. package/lib/components/markdown.test.js.map +1 -1
  59. package/lib/document.test.js +3 -1
  60. package/lib/document.test.js.map +1 -1
  61. package/lib/jdd-context.js +12 -4
  62. package/lib/jdd-context.js.map +1 -1
  63. package/lib/jdd.js +8 -6
  64. package/lib/jdd.js.map +1 -1
  65. package/lib/jdd.test.js +4 -1
  66. package/lib/jdd.test.js.map +1 -1
  67. package/lib/markdown.test.js +4 -2
  68. package/lib/markdown.test.js.map +1 -1
  69. package/lib/render.test.js +3 -1
  70. package/lib/render.test.js.map +1 -1
  71. package/lib/test-utils/prettier.js +1 -1
  72. package/lib/test-utils/prettier.js.map +1 -1
  73. package/lib/test-utils/simplest-context.js +3 -1
  74. package/lib/test-utils/simplest-context.js.map +1 -1
  75. package/lib/utils/insert_nbsp.js +2 -1
  76. package/lib/utils/insert_nbsp.js.map +1 -1
  77. package/package.json +2 -2
  78. package/.nyc_output/e011c901-5465-47ac-9da1-eca657e5bb92.json +0 -1
  79. package/.nyc_output/processinfo/e011c901-5465-47ac-9da1-eca657e5bb92.json +0 -1
@@ -0,0 +1 @@
1
+ {"parent":null,"pid":3075447,"argv":["/home/kuba/.nvm/versions/node/v21.6.2/bin/node","/home/kuba/projects/sealcode/jdd/node_modules/.bin/mocha","--recursive","--timeout=10000","--require","source-map-support/register","--reporter","xunit","--reporter-option","output=.xunit","lib-instrumented/**/*.test.js"],"execArgv":[],"cwd":"/home/kuba/projects/sealcode/jdd","time":1732816052029,"ppid":3075436,"coverageFilename":"/home/kuba/projects/sealcode/jdd/.nyc_output/5ddf9c01-2e58-48c7-b45f-0b14d93f5fc2.json","externalId":"","uuid":"5ddf9c01-2e58-48c7-b45f-0b14d93f5fc2","files":["/home/kuba/projects/sealcode/jdd/lib/api.test.js","/home/kuba/projects/sealcode/jdd/lib/component-arguments/component-argument.js","/home/kuba/projects/sealcode/jdd/lib/component-arguments/container-argument.js","/home/kuba/projects/sealcode/jdd/lib/component-arguments/list.js","/home/kuba/projects/sealcode/jdd/lib/component-arguments/file.js","/home/kuba/projects/sealcode/jdd/lib/utils/module-dirname.js","/home/kuba/projects/sealcode/jdd/lib/component-arguments/image.js","/home/kuba/projects/sealcode/jdd/lib/component-arguments/string-based-argument.js","/home/kuba/projects/sealcode/jdd/lib/component-arguments/short-text.js","/home/kuba/projects/sealcode/jdd/lib/component-arguments/structured.js","/home/kuba/projects/sealcode/jdd/lib/component-arguments/number.js","/home/kuba/projects/sealcode/jdd/lib/component-arguments/enum.js","/home/kuba/projects/sealcode/jdd/lib/component-arguments/markdown.js","/home/kuba/projects/sealcode/jdd/lib/component.js","/home/kuba/projects/sealcode/jdd/lib/component-arguments/url.js","/home/kuba/projects/sealcode/jdd/lib/utils/insert_nbsp.js","/home/kuba/projects/sealcode/jdd/lib/hyphenation.js","/home/kuba/projects/sealcode/jdd/lib/jdd-context.js","/home/kuba/projects/sealcode/jdd/lib/component-arguments/component-arguments.test.js","/home/kuba/projects/sealcode/jdd/lib/component-arguments/enum.test.js","/home/kuba/projects/sealcode/jdd/lib/component-arguments/file.test.js","/home/kuba/projects/sealcode/jdd/lib/component-arguments/list.test.js","/home/kuba/projects/sealcode/jdd/lib/component-arguments/structured.test.js","/home/kuba/projects/sealcode/jdd/lib/component-arguments/table.js","/home/kuba/projects/sealcode/jdd/lib/component-arguments/table.test.js","/home/kuba/projects/sealcode/jdd/lib/component-arguments/single-reference.js","/home/kuba/projects/sealcode/jdd/lib/component-arguments/component-arguments.js","/home/kuba/projects/sealcode/jdd/lib/registry.js","/home/kuba/projects/sealcode/jdd/lib/document.js","/home/kuba/projects/sealcode/jdd/lib/jdd.js","/home/kuba/projects/sealcode/jdd/lib/index.js","/home/kuba/projects/sealcode/jdd/lib/component.test.js","/home/kuba/projects/sealcode/jdd/lib/components/markdown.js","/home/kuba/projects/sealcode/jdd/lib/test-utils/prettier.js","/home/kuba/projects/sealcode/jdd/lib/test-utils/simplest-context.js","/home/kuba/projects/sealcode/jdd/lib/components/markdown.test.js","/home/kuba/projects/sealcode/jdd/lib/document.test.js","/home/kuba/projects/sealcode/jdd/lib/jdd.test.js","/home/kuba/projects/sealcode/jdd/lib/markdown.test.js","/home/kuba/projects/sealcode/jdd/lib/render.test.js","/home/kuba/projects/sealcode/jdd/lib/utils/insert_nbsp.test.js"]}
@@ -1 +1 @@
1
- {"processes":{"e011c901-5465-47ac-9da1-eca657e5bb92":{"parent":null,"children":[]}},"files":{"/home/kuba/projects/sealcode/jdd/lib/api.test.js":["e011c901-5465-47ac-9da1-eca657e5bb92"],"/home/kuba/projects/sealcode/jdd/lib/component-arguments/component-argument.js":["e011c901-5465-47ac-9da1-eca657e5bb92"],"/home/kuba/projects/sealcode/jdd/lib/component-arguments/container-argument.js":["e011c901-5465-47ac-9da1-eca657e5bb92"],"/home/kuba/projects/sealcode/jdd/lib/component-arguments/list.js":["e011c901-5465-47ac-9da1-eca657e5bb92"],"/home/kuba/projects/sealcode/jdd/lib/component-arguments/file.js":["e011c901-5465-47ac-9da1-eca657e5bb92"],"/home/kuba/projects/sealcode/jdd/lib/utils/module-dirname.js":["e011c901-5465-47ac-9da1-eca657e5bb92"],"/home/kuba/projects/sealcode/jdd/lib/component-arguments/image.js":["e011c901-5465-47ac-9da1-eca657e5bb92"],"/home/kuba/projects/sealcode/jdd/lib/component-arguments/string-based-argument.js":["e011c901-5465-47ac-9da1-eca657e5bb92"],"/home/kuba/projects/sealcode/jdd/lib/component-arguments/short-text.js":["e011c901-5465-47ac-9da1-eca657e5bb92"],"/home/kuba/projects/sealcode/jdd/lib/component-arguments/structured.js":["e011c901-5465-47ac-9da1-eca657e5bb92"],"/home/kuba/projects/sealcode/jdd/lib/component-arguments/enum.js":["e011c901-5465-47ac-9da1-eca657e5bb92"],"/home/kuba/projects/sealcode/jdd/lib/component-arguments/markdown.js":["e011c901-5465-47ac-9da1-eca657e5bb92"],"/home/kuba/projects/sealcode/jdd/lib/component.js":["e011c901-5465-47ac-9da1-eca657e5bb92"],"/home/kuba/projects/sealcode/jdd/lib/component-arguments/url.js":["e011c901-5465-47ac-9da1-eca657e5bb92"],"/home/kuba/projects/sealcode/jdd/lib/utils/insert_nbsp.js":["e011c901-5465-47ac-9da1-eca657e5bb92"],"/home/kuba/projects/sealcode/jdd/lib/jdd-context.js":["e011c901-5465-47ac-9da1-eca657e5bb92"],"/home/kuba/projects/sealcode/jdd/lib/component-arguments/component-arguments.test.js":["e011c901-5465-47ac-9da1-eca657e5bb92"],"/home/kuba/projects/sealcode/jdd/lib/component-arguments/file.test.js":["e011c901-5465-47ac-9da1-eca657e5bb92"],"/home/kuba/projects/sealcode/jdd/lib/component-arguments/list.test.js":["e011c901-5465-47ac-9da1-eca657e5bb92"],"/home/kuba/projects/sealcode/jdd/lib/component-arguments/structured.test.js":["e011c901-5465-47ac-9da1-eca657e5bb92"],"/home/kuba/projects/sealcode/jdd/lib/component-arguments/table.js":["e011c901-5465-47ac-9da1-eca657e5bb92"],"/home/kuba/projects/sealcode/jdd/lib/component-arguments/table.test.js":["e011c901-5465-47ac-9da1-eca657e5bb92"],"/home/kuba/projects/sealcode/jdd/lib/component-arguments/component-arguments.js":["e011c901-5465-47ac-9da1-eca657e5bb92"],"/home/kuba/projects/sealcode/jdd/lib/registry.js":["e011c901-5465-47ac-9da1-eca657e5bb92"],"/home/kuba/projects/sealcode/jdd/lib/document.js":["e011c901-5465-47ac-9da1-eca657e5bb92"],"/home/kuba/projects/sealcode/jdd/lib/index.js":["e011c901-5465-47ac-9da1-eca657e5bb92"],"/home/kuba/projects/sealcode/jdd/lib/component.test.js":["e011c901-5465-47ac-9da1-eca657e5bb92"],"/home/kuba/projects/sealcode/jdd/lib/components/markdown.js":["e011c901-5465-47ac-9da1-eca657e5bb92"],"/home/kuba/projects/sealcode/jdd/lib/components/markdown.test.js":["e011c901-5465-47ac-9da1-eca657e5bb92"],"/home/kuba/projects/sealcode/jdd/lib/document.test.js":["e011c901-5465-47ac-9da1-eca657e5bb92"],"/home/kuba/projects/sealcode/jdd/lib/utils/insert_nbsp.test.js":["e011c901-5465-47ac-9da1-eca657e5bb92"]},"externalIds":{}}
1
+ {"processes":{"5ddf9c01-2e58-48c7-b45f-0b14d93f5fc2":{"parent":null,"children":[]}},"files":{"/home/kuba/projects/sealcode/jdd/lib/api.test.js":["5ddf9c01-2e58-48c7-b45f-0b14d93f5fc2"],"/home/kuba/projects/sealcode/jdd/lib/component-arguments/component-argument.js":["5ddf9c01-2e58-48c7-b45f-0b14d93f5fc2"],"/home/kuba/projects/sealcode/jdd/lib/component-arguments/container-argument.js":["5ddf9c01-2e58-48c7-b45f-0b14d93f5fc2"],"/home/kuba/projects/sealcode/jdd/lib/component-arguments/list.js":["5ddf9c01-2e58-48c7-b45f-0b14d93f5fc2"],"/home/kuba/projects/sealcode/jdd/lib/component-arguments/file.js":["5ddf9c01-2e58-48c7-b45f-0b14d93f5fc2"],"/home/kuba/projects/sealcode/jdd/lib/utils/module-dirname.js":["5ddf9c01-2e58-48c7-b45f-0b14d93f5fc2"],"/home/kuba/projects/sealcode/jdd/lib/component-arguments/image.js":["5ddf9c01-2e58-48c7-b45f-0b14d93f5fc2"],"/home/kuba/projects/sealcode/jdd/lib/component-arguments/string-based-argument.js":["5ddf9c01-2e58-48c7-b45f-0b14d93f5fc2"],"/home/kuba/projects/sealcode/jdd/lib/component-arguments/short-text.js":["5ddf9c01-2e58-48c7-b45f-0b14d93f5fc2"],"/home/kuba/projects/sealcode/jdd/lib/component-arguments/structured.js":["5ddf9c01-2e58-48c7-b45f-0b14d93f5fc2"],"/home/kuba/projects/sealcode/jdd/lib/component-arguments/number.js":["5ddf9c01-2e58-48c7-b45f-0b14d93f5fc2"],"/home/kuba/projects/sealcode/jdd/lib/component-arguments/enum.js":["5ddf9c01-2e58-48c7-b45f-0b14d93f5fc2"],"/home/kuba/projects/sealcode/jdd/lib/component-arguments/markdown.js":["5ddf9c01-2e58-48c7-b45f-0b14d93f5fc2"],"/home/kuba/projects/sealcode/jdd/lib/component.js":["5ddf9c01-2e58-48c7-b45f-0b14d93f5fc2"],"/home/kuba/projects/sealcode/jdd/lib/component-arguments/url.js":["5ddf9c01-2e58-48c7-b45f-0b14d93f5fc2"],"/home/kuba/projects/sealcode/jdd/lib/utils/insert_nbsp.js":["5ddf9c01-2e58-48c7-b45f-0b14d93f5fc2"],"/home/kuba/projects/sealcode/jdd/lib/hyphenation.js":["5ddf9c01-2e58-48c7-b45f-0b14d93f5fc2"],"/home/kuba/projects/sealcode/jdd/lib/jdd-context.js":["5ddf9c01-2e58-48c7-b45f-0b14d93f5fc2"],"/home/kuba/projects/sealcode/jdd/lib/component-arguments/component-arguments.test.js":["5ddf9c01-2e58-48c7-b45f-0b14d93f5fc2"],"/home/kuba/projects/sealcode/jdd/lib/component-arguments/enum.test.js":["5ddf9c01-2e58-48c7-b45f-0b14d93f5fc2"],"/home/kuba/projects/sealcode/jdd/lib/component-arguments/file.test.js":["5ddf9c01-2e58-48c7-b45f-0b14d93f5fc2"],"/home/kuba/projects/sealcode/jdd/lib/component-arguments/list.test.js":["5ddf9c01-2e58-48c7-b45f-0b14d93f5fc2"],"/home/kuba/projects/sealcode/jdd/lib/component-arguments/structured.test.js":["5ddf9c01-2e58-48c7-b45f-0b14d93f5fc2"],"/home/kuba/projects/sealcode/jdd/lib/component-arguments/table.js":["5ddf9c01-2e58-48c7-b45f-0b14d93f5fc2"],"/home/kuba/projects/sealcode/jdd/lib/component-arguments/table.test.js":["5ddf9c01-2e58-48c7-b45f-0b14d93f5fc2"],"/home/kuba/projects/sealcode/jdd/lib/component-arguments/single-reference.js":["5ddf9c01-2e58-48c7-b45f-0b14d93f5fc2"],"/home/kuba/projects/sealcode/jdd/lib/component-arguments/component-arguments.js":["5ddf9c01-2e58-48c7-b45f-0b14d93f5fc2"],"/home/kuba/projects/sealcode/jdd/lib/registry.js":["5ddf9c01-2e58-48c7-b45f-0b14d93f5fc2"],"/home/kuba/projects/sealcode/jdd/lib/document.js":["5ddf9c01-2e58-48c7-b45f-0b14d93f5fc2"],"/home/kuba/projects/sealcode/jdd/lib/jdd.js":["5ddf9c01-2e58-48c7-b45f-0b14d93f5fc2"],"/home/kuba/projects/sealcode/jdd/lib/index.js":["5ddf9c01-2e58-48c7-b45f-0b14d93f5fc2"],"/home/kuba/projects/sealcode/jdd/lib/component.test.js":["5ddf9c01-2e58-48c7-b45f-0b14d93f5fc2"],"/home/kuba/projects/sealcode/jdd/lib/components/markdown.js":["5ddf9c01-2e58-48c7-b45f-0b14d93f5fc2"],"/home/kuba/projects/sealcode/jdd/lib/test-utils/prettier.js":["5ddf9c01-2e58-48c7-b45f-0b14d93f5fc2"],"/home/kuba/projects/sealcode/jdd/lib/test-utils/simplest-context.js":["5ddf9c01-2e58-48c7-b45f-0b14d93f5fc2"],"/home/kuba/projects/sealcode/jdd/lib/components/markdown.test.js":["5ddf9c01-2e58-48c7-b45f-0b14d93f5fc2"],"/home/kuba/projects/sealcode/jdd/lib/document.test.js":["5ddf9c01-2e58-48c7-b45f-0b14d93f5fc2"],"/home/kuba/projects/sealcode/jdd/lib/jdd.test.js":["5ddf9c01-2e58-48c7-b45f-0b14d93f5fc2"],"/home/kuba/projects/sealcode/jdd/lib/markdown.test.js":["5ddf9c01-2e58-48c7-b45f-0b14d93f5fc2"],"/home/kuba/projects/sealcode/jdd/lib/render.test.js":["5ddf9c01-2e58-48c7-b45f-0b14d93f5fc2"],"/home/kuba/projects/sealcode/jdd/lib/utils/insert_nbsp.test.js":["5ddf9c01-2e58-48c7-b45f-0b14d93f5fc2"]},"externalIds":{}}
package/.xunit CHANGED
@@ -1,4 +1,4 @@
1
- <testsuite name="Mocha Tests" tests="27" failures="0" errors="0" skipped="0" timestamp="Sun, 05 May 2024 14:50:57 GMT" time="0.029">
1
+ <testsuite name="Mocha Tests" tests="41" failures="0" errors="0" skipped="0" timestamp="Thu, 28 Nov 2024 17:47:32 GMT" time="0.287">
2
2
  <testcase classname="component arguments" name="handles nesting objects and arrays" time="0"/>
3
3
  <testcase classname="component arguments" name="handles enums" time="0"/>
4
4
  <testcase classname="component arguments" name="Gives a nice example" time="0.001"/>
@@ -10,20 +10,34 @@
10
10
  <testcase classname="component arguments Word counting" name="MarkdownArgument argument" time="0"/>
11
11
  <testcase classname="component arguments Word counting" name="List argument" time="0"/>
12
12
  <testcase classname="component arguments Word counting" name="Structured argument" time="0"/>
13
- <testcase classname="component arguments List argument" name="Generates example values from provided examples, if they are provided" time="0.001"/>
13
+ <testcase classname="component arguments List argument" name="Generates example values from provided examples, if they are provided" time="0"/>
14
14
  <testcase classname="component arguments test URL component argument class" name="allows for chaining methods when setting example values" time="0"/>
15
15
  <testcase classname="component arguments test URL component argument class" name="returns example url of type based on specyfic urlType argument" time="0"/>
16
16
  <testcase classname="component arguments test URL component argument class" name="returns correct component argument type" time="0"/>
17
+ <testcase classname="component arguments test Number component argument" name="Generates example values from provided values, if they are provided" time="0"/>
18
+ <testcase classname="component arguments test Number component argument" name="Generates example value in compliance with given min, max and range constrains" time="0"/>
19
+ <testcase classname="component arguments test Number component argument" name="Returns expected type, empty value and count words number" time="0.002"/>
20
+ <testcase classname="enum argument" name="uses only the example values if provided when running getExampleValues" time="0"/>
17
21
  <testcase classname="File field" name="Properly describes the parsed value" time="0"/>
18
22
  <testcase classname="list" name="allows for creating a list of images" time="0"/>
19
23
  <testcase classname="list" name="properly parses list arguments" time="0"/>
20
- <testcase classname="structured argument" name="properly extracts parsed type" time="0.001"/>
24
+ <testcase classname="list" name="handles undefined value" time="0.001"/>
25
+ <testcase classname="structured argument" name="properly extracts parsed type" time="0"/>
21
26
  <testcase classname="structured argument" name="properly extracts parsed type within a list" time="0"/>
27
+ <testcase classname="structured argument" name="uses the provided object as an example value if set" time="0"/>
22
28
  <testcase classname="table argument" name="properly parses type value" time="0"/>
23
- <testcase classname="component class getSubArgument" name="traverses argument path that includes a table" time="0.003"/>
24
- <testcase classname="markdown component" name="renders as a part of a JDD" time="0.016"/>
25
- <testcase classname="document" name="converts from parsed to storage" time="0"/>
26
- <testcase classname="create non braking space util" name="should replace space for one letter word with non braking space" time="0"/>
29
+ <testcase classname="table argument" name="properly respects custom set example value" time="0.001"/>
30
+ <testcase classname="component class" name="Doesn&#x27;t fail if provided with unknown arguments" time="0"/>
31
+ <testcase classname="component class getSubArgument" name="traverses argument path that includes a table" time="0.001"/>
32
+ <testcase classname="markdown component" name="renders as a part of a JDD" time="0.074"/>
33
+ <testcase classname="markdown component" name="properly returns the headings" time="0.004"/>
34
+ <testcase classname="markdown component" name="allows for nbsp in headings" time="0.01"/>
35
+ <testcase classname="document" name="converts from parsed to storage" time="0.001"/>
36
+ <testcase classname="jdd" name="properly extracts headings from multiple components" time="0"/>
37
+ <testcase classname="jdd" name="properly extracts css clumps" time="0.001"/>
38
+ <testcase classname="markdown" name="does not insert soft hyphens into links" time="0"/>
39
+ <testcase classname="render method renderFromStorage" name="renders from a raw document" time="0.182"/>
40
+ <testcase classname="create non braking space util" name="should replace space for one letter word with non braking space" time="0.001"/>
27
41
  <testcase classname="create non braking space util" name="should keep original copy if there isn&#x27;t any one letter word" time="0"/>
28
42
  <testcase classname="create non braking space util" name="shold find one letter word on first position" time="0"/>
29
43
  </testsuite>
@@ -0,0 +1 @@
1
+ export declare function componentNameToCSSClump(component_name: string): string;
@@ -19,8 +19,9 @@ export declare abstract class ComponentArgument<ParsedType, StorageType = Parsed
19
19
  parent_argument: ComponentArgument<unknown> | null;
20
20
  abstract getTypeName(): string;
21
21
  abstract getEmptyValue(ctx: JDDContext): ParsedType | Promise<ParsedType>;
22
- abstract countWords(value: ParsedType): number;
23
- abstract getSubArgument(path: string[], value: ParsedType): readonly [ComponentArgument<unknown> | null, string[], unknown];
22
+ abstract countWords(ctx: JDDContext, value: ParsedType): number;
23
+ isEmpty(value: ParsedType): boolean;
24
+ abstract getSubArgument(ctx: JDDContext, path: string[], value: ParsedType): readonly [ComponentArgument<unknown> | null, string[], unknown];
24
25
  abstract receivedToParsed(context: JDDContext, value: ReceivedDataType): Promise<ParsedType | ParsedType[]>;
25
26
  abstract parsedToStorage(context: JDDContext, value: ParsedType): Promise<StorageType>;
26
27
  abstract storageToParsed(context: JDDContext, value: StorageType): Promise<ParsedType>;
@@ -7,4 +7,5 @@ export { ShortText } from "./short-text.js";
7
7
  export { Structured } from "./structured.js";
8
8
  export * from "./single-reference.js";
9
9
  export * from "./table.js";
10
+ export * from "./nested-component.js";
10
11
  export { URL } from "./url.js";
@@ -0,0 +1,15 @@
1
+ import { ComponentArgument } from "./component-argument.js";
2
+ import { ContainerArgument } from "./container-argument.js";
3
+ import { Registry } from "../registry.js";
4
+ import { JDDContext } from "../jdd-context.js";
5
+ export declare class Component extends ContainerArgument<Record<string, unknown>, Record<string, unknown>> {
6
+ registry: Registry;
7
+ constructor(registry: Registry);
8
+ getTypeName(): string;
9
+ getStructure(component_name: string): Record<string, ComponentArgument<unknown>>;
10
+ getSubArgument([key, ...rest]: string[], value: Record<string, unknown>): readonly [ComponentArgument<any> | null, string[], unknown];
11
+ countWords(value: Record<string, unknown>): number;
12
+ getEmptyValue(context: JDDContext): Promise<Record<string, unknown>>;
13
+ getExampleValue(context: JDDContext): Promise<Record<string, unknown>>;
14
+ processAllSubarguments(_context: JDDContext, input: unknown, processing_function: (argument: ComponentArgument<unknown>, value: unknown) => Promise<unknown>): Promise<Record<string, unknown> | Record<string, unknown>[]>;
15
+ }
@@ -7,9 +7,9 @@ export declare class List<ParsedType, T extends ComponentArgument<ParsedType, un
7
7
  constructor(item_type: ComponentArgument<ParsedType, unknown, unknown>, example_count?: number | null);
8
8
  getTypeName(): string;
9
9
  getEmptyValue(): never[];
10
- getSubArgument([key, ...rest]: string[], value: unknown[]): readonly [null, string[], null] | readonly [ComponentArgument<ParsedType, unknown, unknown>, string[], unknown];
10
+ getSubArgument(ctx: JDDContext, [key, ...rest]: string[], value: unknown[]): readonly [null, string[], null] | readonly [ComponentArgument<ParsedType, unknown, unknown>, string[], unknown];
11
11
  getExampleCount(): number;
12
12
  getExampleValue(context: JDDContext): Promise<ParsedType[]>;
13
- countWords(value: Array<ParsedType>): number;
13
+ countWords(ctx: JDDContext, value: Array<ParsedType>): number;
14
14
  processAllSubarguments(_context: JDDContext, values: unknown, processing_function: (argument: ComponentArgument<unknown>, value: unknown) => Promise<unknown>): Promise<T[] | null>;
15
15
  }
@@ -5,7 +5,7 @@ import { JDDHeading } from "../component.js";
5
5
  export declare class MarkdownArgument extends StringBasedArgument<string> {
6
6
  getTypeName(): string;
7
7
  getEmptyValue(): string;
8
- countWords(value: string): number;
8
+ countWords(_: JDDContext, value: string): number;
9
9
  example_values: string[];
10
10
  parseFormInput(_: JDDContext, input: unknown): MaybePromise<string | string[] | null>;
11
11
  extractHeadings(value: string): JDDHeading[];
@@ -0,0 +1,24 @@
1
+ /// <reference types="node" resolution-mode="require"/>
2
+ import { ComponentArgument } from "./component-argument.js";
3
+ import { ContainerArgument } from "./container-argument.js";
4
+ import { Registry } from "../registry.js";
5
+ import { Enum } from "./enum.js";
6
+ import { JDDContext } from "../jdd-context.js";
7
+ import { Structured } from "./structured.js";
8
+ export declare class NestedComponent extends ContainerArgument<Record<string, unknown>, Record<string, unknown>> {
9
+ getTypeName(): string;
10
+ getComponentArgument(registry: Registry): Enum<string>;
11
+ getInnerStructure(registry: Registry, component_name: string): Record<string, ComponentArgument<unknown>>;
12
+ getStructure(registry: Registry, component_name: string): {
13
+ [x: string]: Structured<Record<string, ComponentArgument<unknown, unknown, unknown>>> | Enum<string>;
14
+ component_name: Enum<string>;
15
+ };
16
+ getSubArgument(ctx: JDDContext, [key, ...rest]: string[], value: Record<string, unknown>): readonly [ComponentArgument<any> | null, string[], unknown];
17
+ countWords(ctx: JDDContext, value: Record<string, unknown>): number;
18
+ getEmptyValue(ctx: JDDContext): Promise<Record<string, unknown>>;
19
+ getExampleValue(context: JDDContext): Promise<Record<string, unknown>>;
20
+ processAllSubarguments(context: JDDContext, input: unknown, processing_function: (argument: ComponentArgument<unknown>, value: unknown) => Promise<unknown>): Promise<Record<string, unknown> | Record<string, unknown>[]>;
21
+ static render(jdd_context: JDDContext, data: Record<string, unknown>): string | number | import("stream").Readable | (string | number | import("stream").Readable | null)[] | Promise<string | number | import("stream").Readable | null>[] | Promise<import("tempstream/@types/stringify.js").Stringifiable> | null;
22
+ static getCSSClumpsForNested(jdd_context: JDDContext, data: Record<string, unknown>): string[];
23
+ receivedToParsed(context: JDDContext, value: Record<string, unknown>): Promise<Record<string, unknown>>;
24
+ }
@@ -0,0 +1,23 @@
1
+ import { MaybePromise } from "tempstream";
2
+ import { ComponentArgument } from "./component-argument.js";
3
+ import { JDDContext } from "../jdd-context.js";
4
+ export declare class Number extends ComponentArgument<number, string, string> {
5
+ readonly min: number | undefined;
6
+ readonly max: number | undefined;
7
+ readonly step: number;
8
+ constructor({ min, max, step, }: {
9
+ min?: number;
10
+ max?: number;
11
+ step?: number;
12
+ });
13
+ getSubArgument(): readonly [null, string[], null];
14
+ parsedToFormData(_: JDDContext, value: number): Promise<string>;
15
+ parsedToStorage(_context: JDDContext, value: number): Promise<string>;
16
+ storageToParsed(_context: JDDContext, value: string): Promise<number>;
17
+ receivedToParsed(_context: JDDContext, value: string): Promise<number>;
18
+ getTypeName(): string;
19
+ getEmptyValue(): number;
20
+ getExampleValue(): number;
21
+ countWords(): number;
22
+ parseFormInput(_: JDDContext, input: unknown): MaybePromise<string | null>;
23
+ }
@@ -5,6 +5,6 @@ export declare class ShortText extends StringBasedArgument<string> {
5
5
  example_values: string[];
6
6
  getTypeName(): string;
7
7
  getEmptyValue(): string;
8
- countWords(value: string): number;
8
+ countWords(_: JDDContext, value: string): number;
9
9
  parseFormInput(_: JDDContext, input: unknown): MaybePromise<string | string[] | null>;
10
10
  }
@@ -9,16 +9,18 @@ export declare class Structured<T extends Record<string, ComponentArgument<unkno
9
9
  structure: T;
10
10
  constructor(structure: T);
11
11
  getTypeName(): string;
12
- getSubArgument([key, ...rest]: string[], value: {
12
+ getSubArgument(_ctx: JDDContext, [key, ...rest]: string[], value: {
13
13
  [property in keyof T]: ExtractParsed<T[property]>;
14
14
  }): readonly [ComponentArgument<any> | null, string[], unknown];
15
- countWords(value: {
15
+ countWords(ctx: JDDContext, value: {
16
16
  [property in keyof T]: ExtractParsed<T[property]>;
17
17
  }): number;
18
18
  getEmptyValue(context: JDDContext): Promise<{
19
19
  [property in keyof T]: ExtractParsed<T[property]>;
20
20
  }>;
21
- getExampleValue(context: JDDContext): Promise<{ [property in keyof T]: ExtractParsed<T[property]>; }>;
21
+ getExampleValue(context: JDDContext): Promise<{
22
+ [property in keyof T]: ExtractParsed<T[property]>;
23
+ }>;
22
24
  processAllSubarguments<SingleObject extends {
23
25
  [property in keyof T]: ExtractParsed<T[property]>;
24
26
  }>(_context: JDDContext, input: unknown, processing_function: (argument: ComponentArgument<unknown>, value: unknown) => Promise<unknown>): Promise<SingleObject | SingleObject[] | null>;
@@ -1,6 +1,6 @@
1
- import { JDDContext } from "../index.js";
2
1
  import { ComponentArgument } from "./component-argument.js";
3
2
  import { ContainerArgument } from "./container-argument.js";
3
+ import { JDDContext } from "../jdd-context.js";
4
4
  type TableHeader<HeaderType> = {
5
5
  type: "header";
6
6
  header_content: HeaderType;
@@ -20,7 +20,7 @@ export declare class Table<CellType, HeaderType> extends ContainerArgument<Table
20
20
  header_type: ComponentArgument<HeaderType, unknown, unknown>;
21
21
  cell_type: ComponentArgument<CellType, unknown, unknown>;
22
22
  constructor(header_type: ComponentArgument<HeaderType, unknown, unknown>, cell_type: ComponentArgument<CellType, unknown, unknown>);
23
- getSubArgument([_, key, ...rest]: string[], value: TableData<CellType, HeaderType>): readonly [null, string[], null] | readonly [ComponentArgument<HeaderType, unknown, unknown>, string[], HeaderType] | readonly [ComponentArgument<CellType, unknown, unknown>, string[], CellType];
23
+ getSubArgument(ctx: JDDContext, [_, key, ...rest]: string[], value: TableData<CellType, HeaderType>): readonly [null, string[], null] | readonly [ComponentArgument<HeaderType, unknown, unknown>, string[], HeaderType] | readonly [ComponentArgument<CellType, unknown, unknown>, string[], CellType];
24
24
  getTypeName(): string;
25
25
  getEmptyValue(context: JDDContext): Promise<{
26
26
  rows: ({
@@ -34,7 +34,7 @@ export declare class Table<CellType, HeaderType> extends ContainerArgument<Table
34
34
  })[];
35
35
  }>;
36
36
  getExampleValue(context: JDDContext): Promise<TableData<CellType, HeaderType>>;
37
- countWords(value: TableData<CellType, HeaderType>): number;
37
+ countWords(ctx: JDDContext, value: TableData<CellType, HeaderType>): number;
38
38
  processAllSubarguments(context: JDDContext, input: unknown, processing_function: (argument: ComponentArgument<unknown>, value: unknown) => Promise<unknown>): Promise<TableData<CellType, HeaderType>>;
39
39
  getColumnsCount(value: TableData<CellType, HeaderType>): number;
40
40
  }
@@ -27,14 +27,14 @@ export type ComponentToHTMLArgs<T extends Record<string, ComponentArgument<unkno
27
27
  export declare abstract class Component<ArgumentsT extends Record<string, ComponentArgument<unknown>> = Record<string, ComponentArgument<unknown>>> {
28
28
  abstract getArguments(): ArgumentsT;
29
29
  abstract toHTML(params: ComponentToHTMLArgs<ArgumentsT>): FlatTemplatable | Promise<FlatTemplatable>;
30
- getTitle(context: JDDContext, args: ExtractStructuredComponentArgumentsParsed<ArgumentsT>): string | null;
30
+ getTitle(_context: JDDContext, _args: ExtractStructuredComponentArgumentsParsed<ArgumentsT>): string | null;
31
31
  getHeadings(context: JDDContext, args: ExtractStructuredComponentArgumentsParsed<ArgumentsT>): JDDHeading[];
32
- getCSSClumps(): string[];
32
+ getCSSClumps(_ctx: JDDContext, _params: ExtractStructuredComponentArgumentsParsed<ArgumentsT>): string[];
33
33
  getEarlyAssets(_args: ExtractStructuredComponentArgumentsParsed<ArgumentsT>, _context: JDDContext): Promise<EarlyAsset[]>;
34
- countWords(args: Record<string, unknown>): number;
34
+ countWords(ctx: JDDContext, args: Record<string, unknown>): number;
35
35
  getExampleValues(context: JDDContext): Promise<ExtractStructuredComponentArgumentsParsed<ArgumentsT>>;
36
36
  convertReceivedValuesToParsed(context: JDDContext, values: ExtractStructuredComponentArgumentsReceived<ArgumentsT>): Promise<ExtractStructuredComponentArgumentsParsed<ArgumentsT>>;
37
37
  convertParsedToStorage(context: JDDContext, values: ExtractStructuredComponentArgumentsParsed<ArgumentsT>): Promise<ExtractStructuredComponentArgumentsStorage<ArgumentsT>>;
38
38
  convertStorageToParsed(context: JDDContext, values: ExtractStructuredComponentArgumentsStorage<ArgumentsT>): Promise<ExtractStructuredComponentArgumentsParsed<ArgumentsT>>;
39
- getArgumentAtPath(argument_path: string[], values: ExtractStructuredComponentArgumentsParsed<ArgumentsT>): [ComponentArgument<unknown> | null, string[], unknown];
39
+ getArgumentAtPath(ctx: JDDContext, argument_path: string[], values: ExtractStructuredComponentArgumentsParsed<ArgumentsT>): [ComponentArgument<unknown> | null, string[], unknown];
40
40
  }
package/@types/index.d.ts CHANGED
@@ -7,12 +7,10 @@ export * from "./registry.js";
7
7
  export { insert_nbsp } from "./utils/insert_nbsp.js";
8
8
  export * from "./document.js";
9
9
  export * from "./jdd.js";
10
- import type * as Koa from "koa";
11
10
  import type * as Sealious from "sealious";
12
11
  declare module "koa" {
13
12
  interface BaseContext {
14
13
  $context: Sealious.Context;
15
14
  $body: Record<string, unknown>;
16
- $cache: <T>(key: string, getter: (ctx: Koa.Context) => Promise<T>) => Promise<T>;
17
15
  }
18
16
  }
@@ -2,6 +2,7 @@ import { FileManager, FilePointer, PathFilePointer } from "@sealcode/file-manage
2
2
  import type { KoaResponsiveImageRouter } from "koa-responsive-image-router";
3
3
  import { FlatTemplatable } from "tempstream";
4
4
  import type * as Koa from "koa";
5
+ import { Registry } from "./registry.js";
5
6
  export interface JDDContext {
6
7
  render_image: (file_id: FilePointer | string | null, args: Parameters<KoaResponsiveImageRouter["image"]>[1]) => FlatTemplatable;
7
8
  render_markdown: (language: string, markdown: string) => string | Promise<string>;
@@ -11,6 +12,10 @@ export interface JDDContext {
11
12
  file_manager: FileManager;
12
13
  language: string;
13
14
  ctx: Koa.Context;
15
+ registry: Registry;
14
16
  }
15
- export declare const makeSimpleJDDContext: (file_manager: FileManager) => Omit<JDDContext, "language">;
16
- export declare const makeSimpleEnglishJDDContext: (file_manager?: FileManager) => JDDContext;
17
+ export declare const makeSimpleJDDContext: (file_manager: FileManager, registry: Registry) => Omit<JDDContext, "language">;
18
+ export declare const makeSimpleEnglishJDDContext: (args?: {
19
+ file_manager?: FileManager;
20
+ registry?: Registry;
21
+ }) => JDDContext;
package/@types/jdd.d.ts CHANGED
@@ -13,9 +13,9 @@ export declare class JDD {
13
13
  renderEarlyScript(asset: EarlyAsset): string;
14
14
  renderEarlyStyle(asset: EarlyAsset): string;
15
15
  renderEarlyAssets(): Promise<string>;
16
- countWords(): number;
16
+ countWords(context: JDDContext): number;
17
17
  getHeadings(): JDDHeading[];
18
- getAllCSSClumps(): string[];
18
+ getAllCSSClumps(jdd_context: JDDContext): string[];
19
19
  static renderFromStorage(registry: Registry, document: RawJDDocument, jdd_context: JDDContext): Promise<string>;
20
20
  static renderEarlyAssetsFromStorage(registry: Registry, document: RawJDDocument, jdd_context: JDDContext): Promise<string>;
21
21
  static render(registry: Registry, parsed: JDDocumentContainer<"parsed">, jdd_context: JDDContext): Promise<string>;