@nesso-how/plugin-example 1.0.0-beta.24 → 1.0.0-beta.25

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.
package/README.md CHANGED
@@ -2,14 +2,14 @@
2
2
 
3
3
  Two actions built with the Nesso SDK:
4
4
 
5
- - **Uppercase labels** changes concept labels in the current view. See [`src/index.ts`](src/index.ts).
6
- - **Concept Quiz** uses React to quiz you on the view's relations and saves your progress. See [`src/Quiz.tsx`](src/Quiz.tsx).
5
+ - **Uppercase labels** changes concept labels in the current map. See [`src/index.ts`](src/index.ts).
6
+ - **Concept Quiz** uses React to quiz you on the map's relations and saves your progress. See [`src/Quiz.tsx`](src/Quiz.tsx).
7
7
 
8
8
  ## Install and try
9
9
 
10
10
  In the desktop app, open Settings → Plugins, search for `@nesso-how/plugin-example`, and install it. Approve access to concept labels, panels, and private storage.
11
11
 
12
- Run either action from a view's context menu in the Explorer, or from its actions in the Inspector with nothing selected.
12
+ Run either action from a map's context menu in the Explorer, or from its actions in the Inspector with nothing selected.
13
13
 
14
14
  ## Build your own
15
15
 
package/dist/index.js CHANGED
@@ -10262,7 +10262,7 @@ Bn.define(), ya.define((e) => ({
10262
10262
  }
10263
10263
  });
10264
10264
  // src/Quiz.tsx
10265
- function nd({ document: e, storage: t, viewId: s }) {
10265
+ function nd({ document: e, storage: t, mapId: s }) {
10266
10266
  let [c, l] = r(null), [u, d] = r(!1), f = `quiz:${s ?? "all"}`;
10267
10267
  n(() => {
10268
10268
  t.list().then((e) => {
@@ -10274,7 +10274,7 @@ function nd({ document: e, storage: t, viewId: s }) {
10274
10274
  l(null), await t.set(f, e), d(!1), l(e);
10275
10275
  }
10276
10276
  if (c === null) return null;
10277
- let { concepts: m, relations: h, relationTypes: g } = e.getState().viewGraph, _ = h[c], v = g.find(({ id: e }) => e === _?.predicate), y = (e) => m.find((t) => t.id === e)?.label || e, b = _ ? u ? "Next" : "Show concept" : "Completed";
10277
+ let { concepts: m, relations: h, relationTypes: g } = e.getState().mapGraph, _ = h[c], v = g.find(({ id: e }) => e === _?.predicate), y = (e) => m.find((t) => t.id === e)?.label || e, b = _ ? u ? "Next" : "Show concept" : "Completed";
10278
10278
  return /* @__PURE__ */ a("section", {
10279
10279
  className: "quiz",
10280
10280
  children: /* @__PURE__ */ o("div", {
@@ -10305,7 +10305,7 @@ function nd({ document: e, storage: t, viewId: s }) {
10305
10305
  })] }) : /* @__PURE__ */ a("p", {
10306
10306
  "data-result": !0,
10307
10307
  role: "status",
10308
- children: h.length ? "Quiz complete!" : "This view has no relations."
10308
+ children: h.length ? "Quiz complete!" : "This map has no relations."
10309
10309
  }),
10310
10310
  /* @__PURE__ */ o("footer", { children: [/* @__PURE__ */ a(Wu, {
10311
10311
  variant: "outline",
@@ -10325,7 +10325,7 @@ var rd = () => [{
10325
10325
  id: "uppercase-labels",
10326
10326
  label: { en: "Uppercase labels" },
10327
10327
  run: async ({ document: e }) => {
10328
- let t = e.getState().viewGraph.concepts.map(({ id: e, label: t }) => ({
10328
+ let t = e.getState().mapGraph.concepts.map(({ id: e, label: t }) => ({
10329
10329
  kind: "concept.label",
10330
10330
  id: e,
10331
10331
  value: t.toUpperCase()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nesso-how/plugin-example",
3
- "version": "1.0.0-beta.24",
3
+ "version": "1.0.0-beta.25",
4
4
  "description": "Official example showing how to build Nesso plugins with the SDK and plugin APIs",
5
5
  "keywords": [
6
6
  "nesso-plugin"
@@ -28,12 +28,12 @@
28
28
  "prepack": "npm run build"
29
29
  },
30
30
  "dependencies": {
31
- "@nesso-how/ui": "1.0.0-beta.24",
31
+ "@nesso-how/ui": "1.0.0-beta.25",
32
32
  "react": "^19.2.8",
33
33
  "react-dom": "^19.2.8"
34
34
  },
35
35
  "devDependencies": {
36
- "@nesso-how/plugin": "1.0.0-beta.24",
36
+ "@nesso-how/plugin": "1.0.0-beta.25",
37
37
  "@types/react": "^19.2.18",
38
38
  "@types/react-dom": "^19.2.7",
39
39
  "typescript": "~7.0.2",
@@ -54,7 +54,7 @@
54
54
  }
55
55
  },
56
56
  "nesso": {
57
- "apiVersion": 6,
57
+ "apiVersion": 7,
58
58
  "kind": "actions",
59
59
  "entry": "dist/index.js",
60
60
  "writes": [
package/src/Quiz.tsx CHANGED
@@ -3,10 +3,10 @@ import { Button } from '@nesso-how/ui'
3
3
  import type { ActionContext } from '@nesso-how/plugin'
4
4
  import './Quiz.css'
5
5
 
6
- export function Quiz({ document, storage, viewId }: ActionContext) {
6
+ export function Quiz({ document, storage, mapId }: ActionContext) {
7
7
  const [step, setStep] = useState<number | null>(null)
8
8
  const [revealed, setRevealed] = useState(false)
9
- const key = `quiz:${viewId ?? 'all'}`
9
+ const key = `quiz:${mapId ?? 'all'}`
10
10
 
11
11
  useEffect(() => {
12
12
  void storage.list().then((records) => {
@@ -26,7 +26,7 @@ export function Quiz({ document, storage, viewId }: ActionContext) {
26
26
 
27
27
  if (step === null) return null
28
28
 
29
- const { concepts, relations, relationTypes } = document.getState().viewGraph
29
+ const { concepts, relations, relationTypes } = document.getState().mapGraph
30
30
  const relation = relations[step]
31
31
  const relationType = relationTypes.find(({ id }) => id === relation?.predicate)
32
32
  const conceptLabel = (id: string) => concepts.find((item) => item.id === id)?.label || id
@@ -50,7 +50,7 @@ export function Quiz({ document, storage, viewId }: ActionContext) {
50
50
  </>
51
51
  ) : (
52
52
  <p data-result role="status">
53
- {relations.length ? 'Quiz complete!' : 'This view has no relations.'}
53
+ {relations.length ? 'Quiz complete!' : 'This map has no relations.'}
54
54
  </p>
55
55
  )}
56
56
  <footer>
package/src/index.ts CHANGED
@@ -8,7 +8,7 @@ export const create = (): readonly ActionContribution[] => {
8
8
  run: async ({ document }) => {
9
9
  const state = document.getState()
10
10
 
11
- const operations: readonly NessoOperation[] = state.viewGraph.concepts.map(
11
+ const operations: readonly NessoOperation[] = state.mapGraph.concepts.map(
12
12
  ({ id, label }) => ({
13
13
  kind: 'concept.label',
14
14
  id,