lit-rdf 0.2.1 → 0.3.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 (58) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/README.md +65 -0
  3. package/custom-elements.json +933 -0
  4. package/package.json +47 -22
  5. package/src/components/filter-node.d.ts +31 -0
  6. package/src/components/filter-node.js +61 -0
  7. package/src/components/focus-node.d.ts +11 -1
  8. package/src/components/focus-node.js +12 -5
  9. package/src/components/rdf-dataset.d.ts +38 -0
  10. package/src/components/rdf-dataset.js +80 -0
  11. package/src/components/rdf-environment.d.ts +13 -3
  12. package/src/components/rdf-environment.js +18 -6
  13. package/src/components/rdf-graph.d.ts +23 -0
  14. package/src/components/rdf-graph.js +55 -0
  15. package/src/components/resource-label.d.ts +10 -0
  16. package/src/components/resource-label.js +12 -1
  17. package/src/components/resource-link.d.ts +12 -0
  18. package/src/components/resource-link.js +8 -0
  19. package/src/components/resource-value.d.ts +12 -0
  20. package/src/components/resource-value.js +28 -0
  21. package/src/components/target-node.d.ts +45 -3
  22. package/src/components/target-node.js +76 -14
  23. package/src/components/traverse-graph.d.ts +31 -6
  24. package/src/components/traverse-graph.js +42 -7
  25. package/src/constructor.d.ts +7 -7
  26. package/src/context.d.ts +53 -3
  27. package/src/context.js +20 -0
  28. package/src/controllers/Dataset.d.ts +27 -0
  29. package/src/controllers/Dataset.js +41 -0
  30. package/src/controllers/Environment.d.ts +14 -1
  31. package/src/controllers/Environment.js +15 -1
  32. package/src/controllers/FocusNode.d.ts +20 -0
  33. package/src/controllers/FocusNode.js +24 -9
  34. package/src/controllers.d.ts +10 -1
  35. package/src/controllers.js +10 -1
  36. package/src/converter.d.ts +9 -0
  37. package/src/converter.js +11 -2
  38. package/src/custom-elements.d.ts +173 -0
  39. package/src/index.d.ts +9 -1
  40. package/src/index.js +9 -1
  41. package/src/mixins/environment.d.ts +7 -0
  42. package/src/mixins/environment.js +7 -3
  43. package/src/mixins.d.ts +3 -1
  44. package/src/mixins.js +3 -1
  45. package/src/runtime/data-graph.d.ts +5 -0
  46. package/src/runtime/data-graph.js +8 -5
  47. package/src/sort.d.ts +26 -0
  48. package/src/sort.js +82 -0
  49. package/src/components/data-graph.d.ts +0 -9
  50. package/src/components/data-graph.js +0 -30
  51. package/src/controllers/Graph.d.ts +0 -7
  52. package/src/controllers/Graph.js +0 -14
  53. package/src/mixins/graph.d.ts +0 -2
  54. package/src/mixins/graph.js +0 -21
  55. package/src/mixins/targetNode.d.ts +0 -9
  56. package/src/mixins/targetNode.js +0 -68
  57. package/src/mixins/traverseGraph.d.ts +0 -5
  58. package/src/mixins/traverseGraph.js +0 -38
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # lit-rdf
2
2
 
3
+ ## 0.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 78012d0: Removed mixins `provideDataset`, `provideGraph`, `provideTargetNode` and `traverseGraph`. Their functionality is now provided by the respective elements.
8
+ - 78012d0: Removed `data-graph` and introduced `rdf-dataset` and `rdf-graph` instead
9
+
10
+ ### Patch Changes
11
+
12
+ - b3e31ed: Added `<filter-node>` element
13
+
14
+ ## 0.2.2
15
+
16
+ ### Patch Changes
17
+
18
+ - af27103: Sorting numeric literals is now correctly based on value and not plain literal form
19
+ - af27103: Added `<resource-value>` component
20
+
3
21
  ## 0.2.1
4
22
 
5
23
  ### Patch Changes
package/README.md ADDED
@@ -0,0 +1,65 @@
1
+ # lit-rdf
2
+
3
+ A collection of lightweight, declarative Web Components for building RDF-driven user interfaces with [Lit](https://lit.dev) and [Clownface](https://zazuko.github.io/clownface/).
4
+
5
+ Interactive examples, live previews, and API documentation are available in the [Storybook](https://hypermedia-app.github.io/lit-rdf/).
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ npm install lit-rdf
11
+ ```
12
+
13
+ ## Available Elements
14
+
15
+ | Element | Description | Storybook |
16
+ | --- | --- | --- |
17
+ | [`<rdf-environment>`](src/components/rdf-environment.ts) | Provides an RDF/JS environment in the context for downstream elements. | - |
18
+ | [`<rdf-dataset>`](src/components/rdf-dataset.ts) | Combines child `<rdf-graph>` elements into a single RDF dataset. | - |
19
+ | [`<rdf-graph>`](src/components/rdf-graph.ts) | Data source for parent `<rdf-dataset>` elements. | - |
20
+ | [`<target-node>`](src/components/target-node.ts) | Selects focus nodes from the graph (by type, predicate, or path) with optional sorting. | [Docs](https://hypermedia-app.github.io/lit-rdf/?path=/docs/target-node--docs) ([Source](stories/TargetNode.stories.ts)) |
21
+ | [`<focus-node>`](src/components/focus-node.ts) | Sets or provides focus nodes in the context for child elements. | - |
22
+ | [`<filter-node>`](src/components/filter-node.ts) | Filters the current focus nodes using clownface filter callbacks. | [Docs](https://hypermedia-app.github.io/lit-rdf/?path=/docs/filter-node--docs) ([Source](stories/FilterNode.stories.ts)) |
23
+ | [`<traverse-graph>`](src/components/traverse-graph.ts) | Traverses RDF graph relationships along property paths and renders object nodes. | - |
24
+ | [`<resource-label>`](src/components/resource-label.ts) | Renders a human-readable label for the focus node (`rdfs:label`, `schema:name`, etc.). | - |
25
+ | [`<resource-link>`](src/components/resource-link.ts) | Renders an anchor (`<a>`) tag linking to a resource URI or property value. | - |
26
+ | [`<resource-value>`](src/components/resource-value.ts) | Formats and displays literal or resource values from the focus node. | - |
27
+
28
+ ## Example Usage
29
+
30
+ Import the elements into your project:
31
+
32
+ ```typescript
33
+ import 'lit-rdf'
34
+ ```
35
+
36
+ Compose them declaratively in your HTML or Lit templates:
37
+
38
+ ```html
39
+ <rdf-environment>
40
+ <rdf-dataset id="graph2">
41
+ <!-- rdf-dataset combines the data from rdf-graph elements -->
42
+ <rdf-graph .value="${graph}">
43
+ <!-- Target person nodes and sort them by name -->
44
+ <target-node target-class="schema:Person" order-by="schema:name">
45
+ <!-- Filter nodes (e.g. by custom condition) -->
46
+ <filter-node .filter=${person => Number(person.out(ns.schema.age).value) >= 18}>
47
+ <article>
48
+ <!-- Display resource label and properties -->
49
+ <h2><resource-label></resource-label></h2>
50
+ <p>Homepage: <resource-link property="schema:url"></resource-link></p>
51
+
52
+ <!-- Traverse relations -->
53
+ <h3>Friends:</h3>
54
+ <traverse-graph property-path="schema:knows">
55
+ <p><resource-label></resource-label></p>
56
+ </traverse-graph>
57
+ </article>
58
+ </filter-node>
59
+ </target-node>
60
+ </rdf-graph>
61
+ </rdf-dataset>
62
+ </rdf-environment>
63
+ ```
64
+
65
+ For more detailed guides and interactive demonstrations, visit the [Storybook documentation](https://hypermedia-app.github.io/lit-rdf/).